package views;

import data.ChildData;
import haxe.ui.containers.dialogs.Dialog;

class BaseEditerDialog extends Dialog {
	public var data:ChildData;

	public function new() {
		super();
		this.buttons = "取消|确定";
		defaultButton = "确定";
	}

	public function setData(data:ChildData):Void {
		this.data = data;
	}

	public function writeSourceData():Void {
		var data = data.source;
		var write = getWriteSourceData();
		if (write != null) {
			var keys = Reflect.fields(write);
			for (key in keys) {
				Reflect.setProperty(data, key, Reflect.getProperty(write, key));
			}
		}
	}

	public function getWriteSourceData():Dynamic {
		return null;
	}
}
